home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 1.0 for Developers / QuickTime 1.0 for Developers.iso / Programming Stuff / Interfaces / Movies Interfaces / Components.p < prev    next >
Text File  |  1991-09-11  |  8KB  |  236 lines

  1.  
  2. {
  3. Created: Wednesday, August 14, 1991 at 12:11 PM
  4.  Components.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.  Copyright Apple Computer, Inc. 1990 - 1991
  8.  All rights reserved
  9. }
  10.  
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT Components;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingComponents}
  22. {$SETC UsingComponents := 1}
  23.  
  24. {$I+}
  25. {$SETC ComponentsIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingTypes}
  28. {$I $$Shell(PInterfaces)Types.p}
  29. {$ENDC}
  30. {$SETC UsingIncludes := ComponentsIncludes}
  31.  
  32. CONST
  33. gestaltComponentMgr = 'cpnt';
  34.  
  35. kSmallestArray = 1;
  36. kFix1 = $00010000;
  37.  
  38. TYPE
  39. ComponentDescription = RECORD
  40.  componentType: LONGINT;                            { A unique 4-byte code indentifying the command set }
  41.  componentSubType: LONGINT;                            { Particular flavor of this instance }
  42.  componentManufacturer: LONGINT;                    { Vendor indentification }
  43.  componentFlags: LONGINT;                            { 8 each for Component,Type,SubType,Manuf/revision }
  44.  componentFlagsMask: LONGINT;                        { Mask for specifying which flags to consider in search, zero during registration }
  45.  END;
  46.  
  47. ResourceSpec = RECORD
  48.  resType: LONGINT;                                    { 4-byte code  }
  49.  resId: INTEGER;                                    {    }
  50.  END;
  51.  
  52. ComponentResourcePtr = ^ComponentResource;
  53. ComponentResourceHandle = ^ComponentResourcePtr;
  54. ComponentResource = RECORD
  55.  cd: ComponentDescription;                            { Registration parameters }
  56.  component: ResourceSpec;                            { resource where Component code is found }
  57.  componentName: ResourceSpec;                        { name string resource }
  58.  componentInfo: ResourceSpec;                        { info string resource }
  59.  componentIcon: ResourceSpec;                        { icon resource }
  60.  END;
  61.  
  62. { Structure received by Component:  }
  63. ComponentParameters = RECORD
  64.  flags: CHAR;                                        { call modifiers: sync/async, deferred, immed, etc }
  65.  paramSize: CHAR;                                    { size in bytes of actual parameters passed to this call }
  66.  what: INTEGER;                                        { routine selector, negative for Component management calls }
  67.  params: ARRAY [0..kSmallestArray - 1] OF LONGINT;    { actual parameters for the indicated routine }
  68.  END;
  69.  
  70.  
  71. Component = ^ComponentRecord;
  72. ComponentRecord = RECORD
  73.  data: ARRAY [0..0] OF LONGINT;
  74.  END;
  75.  
  76. ComponentInstance = ^ComponentInstanceRecord;
  77. ComponentInstanceRecord = RECORD
  78.  data: ARRAY [0..0] OF LONGINT;
  79.  END;
  80.  
  81.  
  82.  
  83. ComponentResult = LONGINT;
  84.  
  85. ComponentRoutine = LONGINT;
  86.  
  87. ComponentFunction = LONGINT;
  88.  
  89.  
  90.  
  91. { *******************************************************
  92. *                                                     *
  93. *              APPLICATION LEVEL CALLS                *
  94. *                                                     *
  95. *******************************************************
  96. * Component Database Add, Delete, and Query Routines 
  97. *******************************************************
  98.  }
  99. FUNCTION RegisterComponent(VAR cd: ComponentDescription;componentEntryPoint: ComponentRoutine;
  100.  global: INTEGER;componentName: Handle;componentInfo: Handle;componentIcon: Handle): Component;
  101.  INLINE $7001,$A82A;
  102. FUNCTION RegisterComponentResource(tr: ComponentResourceHandle;global: INTEGER): Component;
  103.  INLINE $7012,$A82A;
  104. FUNCTION UnregisterComponent(aComponent: Component): OSErr;
  105.  INLINE $7002,$A82A;
  106.  
  107. FUNCTION FindNextComponent(aComponent: Component;VAR looking: ComponentDescription): Component;
  108.  INLINE $7004,$A82A;
  109. FUNCTION CountComponents(VAR looking: ComponentDescription): LONGINT;
  110.  INLINE $7003,$A82A;
  111.  
  112. FUNCTION GetComponentInfo(aComponent: Component;VAR cd: ComponentDescription;
  113.  componentName: Handle;componentInfo: Handle;componentIcon: Handle): OSErr;
  114.  INLINE $7005,$A82A;
  115. FUNCTION GetComponentListModSeed: LONGINT;
  116.  INLINE $7006,$A82A;
  117.  
  118.  
  119. { *******************************************************
  120. * Component Instance Allocation and dispatch routines 
  121. *******************************************************
  122.  }
  123. FUNCTION OpenComponent(aComponent: Component): ComponentInstance;
  124.  INLINE $7007,$A82A;
  125. FUNCTION CloseComponent(aComponentInstance: ComponentInstance): OSErr;
  126.  INLINE $7008,$A82A;
  127.  
  128. FUNCTION GetComponentInstanceError(aComponentInstance: ComponentInstance): OSErr;
  129.  INLINE $700A,$A82A;
  130.  
  131.  
  132. {  direct calls to the Components  }
  133. FUNCTION ComponentFunctionImplemented(ti: ComponentInstance;ftnNumber: INTEGER): LONGINT;
  134.  INLINE $2F3C,$2,$FFFD,$7000,$A82A;
  135. FUNCTION GetComponentVersion(ti: ComponentInstance): LONGINT;
  136.  INLINE $2F3C,$0,$FFFC,$7000,$A82A;
  137.  
  138. CONST
  139.  
  140. {****************************************************
  141. *                                                    *
  142. *               CALLS MADE BY Components             *
  143. *                                                    *
  144. ******************************************************
  145. ******************************************************
  146. * Required Component routines
  147. ******************************************************}
  148.  
  149. kComponentOpenSelect = -1;                            { ComponentInstance for this open }
  150. kComponentCloseSelect = -2;                            { ComponentInstance for this close }
  151. kComponentCanDoSelect = -3;                            { selector # being queried }
  152. kComponentVersionSelect = -4;                        { no params }
  153. kComponentRegisterSelect = -5;                        { no params }
  154. kComponentTargetSelect = -6;                        { ComponentInstance for top of call chain }
  155.  
  156.  
  157. { *******************************************************
  158. * Component Management routines
  159. *******************************************************
  160.  }
  161. PROCEDURE SetComponentInstanceError(aComponentInstance: ComponentInstance;
  162.  theError: OSErr);
  163.  INLINE $700B,$A82A;
  164.  
  165. FUNCTION GetComponentRefcon(aComponent: Component): LONGINT;
  166.  INLINE $7010,$A82A;
  167. PROCEDURE SetComponentRefcon(aComponent: Component;theRefcon: LONGINT);
  168.  INLINE $7011,$A82A;
  169.  
  170. FUNCTION OpenComponentResFile(aComponent: Component): INTEGER;
  171.  INLINE $7015,$A82A;
  172. FUNCTION CloseComponentResFile(refnum: INTEGER): OSErr;
  173.  INLINE $7018,$A82A;
  174.  
  175.  
  176. { *******************************************************
  177. * Component Instance Management routines
  178. *******************************************************
  179.  }
  180. FUNCTION GetComponentInstanceStorage(aComponentInstance: ComponentInstance): Handle;
  181.  INLINE $700C,$A82A;
  182. PROCEDURE SetComponentInstanceStorage(aComponentInstance: ComponentInstance;
  183.  theStorage: Handle);
  184.  INLINE $700D,$A82A;
  185.  
  186. FUNCTION GetComponentInstanceA5(aComponentInstance: ComponentInstance): LONGINT;
  187.  INLINE $700E,$A82A;
  188. PROCEDURE SetComponentInstanceA5(aComponentInstance: ComponentInstance;
  189.  theA5: LONGINT);
  190.  INLINE $700F,$A82A;
  191.  
  192. FUNCTION CountComponentInstances(aComponent: Component): LONGINT;
  193.  INLINE $7013,$A82A;
  194.  
  195. FUNCTION FindNextCommonComponentInstance(ti: ComponentInstance;t: Component;
  196.  commonEntryPoint: ComponentRoutine): ComponentInstance;
  197.  INLINE $7014,$A82A;
  198.  
  199.  
  200. {  useful helper routines for convenient method dispatching  }
  201. FUNCTION CallComponentFunction(VAR params: ComponentParameters;func: ComponentFunction): LONGINT;
  202.  INLINE $70FF,$A82A;
  203. FUNCTION CallComponentFunctionWithStorage(storage: Handle;VAR params: ComponentParameters;
  204.  func: ComponentFunction): LONGINT;
  205.  INLINE $70FF,$A82A;
  206. FUNCTION DelegateComponentCall(VAR originalParams: ComponentParameters;
  207.  ti: ComponentInstance): LONGINT;
  208.  INLINE $7024,$A82A;
  209.  
  210. CONST
  211.  
  212. { Set Default Component flags }
  213. defaultComponentIdentical = 0;
  214. defaultComponentAnyFlags = 1;
  215. defaultComponentAnyManufacturer = 2;
  216. defaultComponentAnySubType = 4;
  217. defaultComponentAnyFlagsAnyManufacturer = defaultComponentAnyFlags+defaultComponentAnyManufacturer;
  218. defaultComponentAnyFlagsAnyManufacturerAnySubType = defaultComponentAnyFlags+defaultComponentAnyManufacturer+defaultComponentAnySubType;
  219.  
  220. FUNCTION SetDefaultComponent(aComponent: Component;flags: INTEGER): OSErr;
  221.  INLINE $701E,$A82A;
  222. FUNCTION  OpenDefaultComponent(componentType: LONGINT; componentSubType: LONGINT ) : ComponentInstance;
  223.  INLINE $7021,$A82A;
  224. FUNCTION CaptureComponent(capturedComponent: Component;capturingComponent: Component): Component;
  225.  INLINE $701C,$A82A;
  226. FUNCTION UncaptureComponent(aComponent: Component): OSErr;
  227.  INLINE $701D,$A82A;
  228.  
  229.  
  230. {$ENDC} { UsingComponents }
  231.  
  232. {$IFC NOT UsingIncludes}
  233.  END.
  234. {$ENDC}
  235.  
  236.